<?php //echo $html->script('ordencompras/addedit.js'); ?>
<div id="ordencompraDialog" class="hide">
	<h2 id="summary"></h2>
	<?php echo $form->create('Notaingreso', array('controller'=>'notaingreso', 'action'=>'setActualizar')); 
			echo $form->hidden('ordencompra_id', array('value'=>$ordencompra['Ordencompra']['id']));
	?>
		<table class="tablaFormHeader"><?php echo
			'<tr>'
				.'<td>'.$form->label('Documento.numero_serie', __('Numero', true)).' </td>'
				.'<td>'.$form->input('Documento.numero_serie', array('label'=>false,'div'=>false, 'size'=>'20','class'=>'ui-widget-content ui-corner-all', 'readonly'=>true)).'</td>'
				
				.'<td>'.__('Almacen', true).' </td>'
				.'<td>'.$form->input('almacen_id', array('options'=>$almacenes,'label'=>false,'div'=>false, 'class'=>'FormElement text ui-widget-content ui-corner-all')).'</td>'
			.'</tr>'
			
			.'<tr>'
				.'<td>'.__('Orden de compra', true).' </td>'
				.'<td>:&nbsp;'.$ordencompra['Ordencompra']['numero'].'</td>'
			.'</tr>'
			
			.'<tr>'
				.'<td>'.__('Proveedor', true).' </td>'
				.'<td>:&nbsp;'.$ordencompra['Proveedor']['razonsocial'].'</td>'
			.'</tr>'
			.'<tr>'		
				.'<td>'.$form->label('observacion', __('Observaciones', true)).' </td>'
				.'<td colspan=3>'; ?>
				<textarea cols=110 readonly="readonly" class="readonly FormElement text ui-widget-content ui-corner-all" name="data[Ordencompra][observacion]" id="OrdencompraObservacion">
					<?php echo $ordencompra['Ordencompra']['observacion']; ?>
				</textarea> 
				</td>
			</tr>
		</table>

		<br/>
		<table id="detalleordencomprasForm" class="tablaForm tablaFormInput">
			<thead>
				<tr>
					<th class="header" rowspan="2"><div class="span-6 last">Codigo - Descripcion</div></th>
					<th class="header" rowspan="2"><div class="span-2 last">Und x Cj</div></th>
					<th class="header" rowspan="2"><div class="span-2 last">Unidad</div></th>
					<th class="header" colspan="4">Cantidades</th>
					<th class="header" rowspan="2"><div class="span-3 last">Observacion</div></th>
				</tr>	
				<tr>
					<th class="header"><div class="span-2 last">Pedida</div></th>
					<th class="header"><div class="span-2 last">Ingresada</div></th>
					<th class="header"><div class="span-2 last">Faltante</div></th>
					<th class="header"><div class="span-2 last">A Ingresar</div></th>
				</tr>	
			</thead>
			<tbody><?php 
			foreach($ordencompra['Detalles'] as $key=>$detalleordencompras):
			echo
		 	'<tr class="ui-widget-content jqgrow ui-row-ltr">'
				.'<td>'.$detalleordencompras['Articulo']['descripcion'].'</td>'
				.'<td class="text_right">'.$detalleordencompras['Articulo']['unidadxcaja'].'</td>'
				.'<td>'.$detalleordencompras['Unidad']['descripcion'].'</td>'
				.'<td class="text_right">'.$detalleordencompras['Detalleordencompra']['cantidad'].'</td>'
				.'<td class="text_right">'.$detalleordencompras['Detalleordencompra']['cantidad_nt_ing'].'</td>'
				.'<td class="text_right">'.$detalleordencompras['Detalleordencompra']['cantidad_faltante'].'</td>'
				.'<td class="text_right">'.$form->input('Detallenotaingreso.'.$key.'.cantidad',array('class'=>'number text_right text ui-widget-content', 'size'=>'13','label'=>false));
					echo $form->hidden('Detallenotaingreso.'.$key.'.articulo_id',array('value'=>$detalleordencompras['Detalleordencompra']['articulo_id']))
				.'</td>'
				.'<td>'.$detalleordencompras['Detalleordencompra']['observacion'].'</td>'
			.'</tr>';
			endforeach;
			?></tbody>
		</table>
	<?php echo $form->end(); ?>
</div>